<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>24Vue中的列表过渡.html</title>
    <script src="./vue.js"></script>
    <style>
        .v-enter,
        .v-live-to {
            opacity: 0;
        }

        .v-enter-active,
        .v-leave-active {
            transition: opacity 1s;
        }
    </style>
</head>

<body>
    <div id="app">
        <transition-group>
            <!--  <transition-group> 相当于在每一个列表项目外面加了一层 <transition> -->
            <div v-for="item of list" :key="item.id">{{item.title}}</div>
        </transition-group>
        <button @click="handleBtnClick">add</button>
    </div>
    <script>
        var count = 0
        var vm = new Vue({
            el: "#app",
            data: {
                list: []
            },
            methods: {
                handleBtnClick: function () {
                    this.list.push({
                        id: ++count,
                        title: 'hello world'
                    })
                }
            },
        })
    </script>
</body>

</html>